(ns persistent-heap.jc-pheap)

; do I need this?  I want to be in the same package so I can get at package protected stuff
(import '(persistent_heap PersistentHeap))

(defn heap
  "makes a min priority queue with key value pairs.
   a-map should contain objects witgh associated Priorities."
  ([] (new PersistentHeap))
  ([a-map] (let [my-heap (heap)]
             (reduce #(.insert %1 (key %2) (val %2)) my-heap a-map))))

(defn find-min
  "get a map with object and priority of minPri object.
   the key for the data is :data and the key for priority is :pri."
  [a-heap]
;; I don't know how to access package protected stuff even though I think I'm in the same package
;;  {:data (.. a-heap _minVal _userData) 
;;   :pri (.. a-heap _minVal _pri)})
  {:data (.minData a-heap)
   :pri (.minPri a-heap)})



